//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.baidu.trace;

import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.text.TextUtils;
import com.baidu.trace.c.d;

final class v implements Runnable {
    v(u var1, SQLiteDatabase var2) {
        this.b = var1;
        this.a = var2;
        super();
    }

    public final void run() {
        String var1 = "select * from trace_locationinfo;";
        SQLiteDatabase var2 = null;
        Cursor var3 = null;

        try {
            var3 = (var2 = u.a(this.b).getWritableDatabase()).rawQuery(var1, (String[])null);

            while(var3 != null && var3.moveToNext()) {
                if(!TextUtils.isEmpty(var1 = var3.getString(var3.getColumnIndex("location_data"))) && var1.length() >= 8) {
                    byte[] var4 = d.a(var1);
                    long var6 = Long.parseLong(var1.substring(var1.length() - 8, var1.length()), 16);
                    StringBuffer var12;
                    (var12 = new StringBuffer("insert into ")).append("trace_location(").append("loc_time, ").append("entity_name, ").append("location_data) values(?,?,?);");
                    Object[] var13 = new Object[]{Long.valueOf(var6), Trace.e, var4};
                    this.a.execSQL(var12.toString(), var13);
                }
            }

            return;
        } catch (Exception var10) {
            ;
        } finally {
            if(var3 != null) {
                var3.close();
            }

            if(var2 != null) {
                var2.close();
            }

            if(null != u.a(this.b)) {
                u.a(this.b).close();
                u.a(this.b, (SQLiteOpenHelper)null);
            }

            if(null != u.b(this.b)) {
                u.b(this.b).deleteDatabase("LBSTRACE.db");
                u.a(this.b, (Context)null);
            }

        }

    }
}
